<?php

class Student_Model_DbTable_Student extends Zend_Db_Table_Abstract
{

    protected $_name = 'students';
    
    public function getAll(){
    	return $this->fetchAll();
    }
    
    public function getByID($id){
    	 return $this->fetchRow("student_id = $id");
    }
    
    public function addNew($stdName,$addr,$phone,$gradYear,$school,$company,$companyAddr,$skill,$cer,$cerImg,$img,$compImg,$activeDate,$courseID,$stdLesID){
    	 $data = array(
    	 		"student_name"=>$stdName,
    	 		"address"=>$addr,
    	 		"phone"=>$phone,
    	 		"grad_year"=>$gradYear,
    	 		"school"=>$school,
    	 		"company"=>$company,
    	 		"company_addess"=>$companyAddr,
    	 		"skill"=>$skill,
    	 		"cer"=>$cer,
    	 		"cer_image"=>$cerImg,
    	 		"image"=>$img,
    	 		"company_image"=>$compImg,
    	 		"active_date"=>$activeDate,
    	 		"course_id"=>$courseID,
    	 		"student_lession_id"=>$stdLesID,
    	 		"status"=>0
    	 		);
    	 return $this->insert($data);
    }
    
    public function updateStd($id,$stdName,$addr,$phone,$gradYear,$school,$company,$companyAddr,$skill,$cer,$cerImg,$img,$compImg,$activeDate,$courseID,$stdLesID){
    	 $data = array(
    	 		"student_name"=>$stdName,
    	 		"address"=>$addr,
    	 		"phone"=>$phone,
    	 		"grad_year"=>$gradYear,
    	 		"school"=>$school,
    	 		"company"=>$company,
    	 		"company_addess"=>$companyAddr,
    	 		"skill"=>$skill,
    	 		"cer"=>$cer,
    	 		"cer_image"=>$cerImg,
    	 		"image"=>$img,
    	 		"company_image"=>$compImg,
    	 		"active_date"=>$activeDate,
    	 		"course_id"=>$courseID,
    	 		"student_lession_id"=>$stdLesID,
    	 		"status"=>0
    	 		);
    	 return $this->update($data, "student_id = $id");
    }

}

